function del(id) {
    $.ajax({
        type: "GET",
        url: "/del",
        data: {
            "id": id
        },
        success: function (data) {
            if (data == 'ok') {
                window.location = '/getAll';
            } else {
                alert(data);
            }
        }
    });
}

function updateOne(id) {
    const name = $("#name" + id).val();
    const countryCode = $("#countryCode" + id).val();
    const district = $("#district" + id).val();
    const population = $("#population" + id).val();
    const city = {
        "id": id,
        "name": name,
        "countryCode": countryCode,
        "district": district,
        "population": population
    };

    $.ajax({
        type: "POST",
        url: "/update",
        contentType: "application/json; charset=utf-8",
        data: JSON.stringify(city),
        success: function (data) {
            alert(data);
        }
    });
}